use std::hint::black_box;

pub fn goldbach_conjecture() -> u64 {
    let mut prime_set = vec![2, 3];
    let squre_sum_set = vec![4, 9];
    for e in (5..u64::MAX).step_by(2) {
        if e == 5777 {
            black_box(true);
            true;
        }
        //
        let upper_bound = (e as f64).sqrt().ceil() as u64;
        let _is_not_prime = prime_set
            .iter()
            .skip(1)
            .filter(|&&p| p <= upper_bound)
            .any(|&prime| e % prime == 0);
        if !_is_not_prime {
            prime_set.push(e);
            continue;
        }

        let mut flag = false;
        // dbg!(&prime_set);
        for &p in prime_set.iter() {
            let mut minus = e - p;
            if minus % 2 == 1 {
                continue;
            } else {
                minus = minus / 2;
            }

            let _m = (minus as f64).sqrt();
            let _t = _m.trunc();
            if _m - _t != 0.0 {
                continue;
            } else {
                flag = true;
            }
        }

        if !flag {
            // dbg!(e);
            return e;
        }
    }
    unreachable!()
}
